from django.db import models
from dapp_extfields.models import CascadeForeignKey

class ProductClassOne( models.Model ):
    name = models.CharField( max_length = 250 )
    
    def __unicode__( self ):
        return self.name

class ProductClassTwo( models.Model ):
    classone = models.ForeignKey( ProductClassOne )
    name = models.CharField( max_length = 250 )
    
    def __unicode__( self ):
        return "[%s]%s" % ( self.classone.name, self.name )

class ProductClassThree( models.Model ):
    classtwo = models.ForeignKey( ProductClassTwo )
    name = models.CharField( max_length = 250 )
    
    def __unicode__( self ):
        return "[%s][%s]%s" % ( self.classtwo.classone.name, self.classtwo.name, self.name )

class Product( models.Model ):
    classthree = CascadeForeignKey( ProductClassThree )
    name = models.CharField( max_length = 250 )
    
    def __unicode__( self ):
        return "[%s][%s][%s]%s" % ( self.classone.name, self.classtwo.name, self.classthree.name, self.name )
    
